﻿using System;
using System.Threading.Tasks;
using BookSleeve;

namespace RedisDemos.Scenarios
{
    public abstract class Scenario
    {
        protected readonly String Address = "127.0.0.1";
        protected readonly Int32 Port = 6379;
        protected readonly Int32 Db = 0;

        public async Task Execute()
        {
            using (var conn = new RedisConnection(Address, port: Port, allowAdmin: true))
            {
                await conn.Open();
                await conn.Server.FlushAll();
                await Perform(conn);
            }
        }

        protected abstract Task Perform(RedisConnection conn);
    }
}
